package com.wiscamp.ninechapters.problems.domain.models.problems.problems;

import com.wiscamp.ninechapters.common.core.CollectionHelper;
import com.wiscamp.ninechapters.problems.domain.models.problems.questions.Question;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.Collection;

/**
 * 多问题类型复合题
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class HybridProblem extends MultipleQuestionProblem {
    /**
     * 问题列表
     */
    protected Collection<Question> questions = new ArrayList<>();

    @Override
    public Collection<Question> getCurrentQuestions() {
        return CollectionHelper.convertToArrayList(questions);
    }

    @Override
    public void setCurrentQuestions(@NotEmpty Collection<Question> questions) {
        this.questions = questions;
    }

    @Override
    public void addQuestion(@NotNull Question question) {
        this.questions.add(question);
    }
}
